/**
 * Created by ROGSTAR on 2016/11/29.
 */

require.config(window.jshead);
require(['jquery', 'pages', "layer",'navigator','zclip','query'], function ($, pg,layer) {
    layer.config({
        path: '/js/layer/'
    });

    //邀请列表

    pg.paging(1, 6, "/user/inviteList", 'friendsList', 'friendsListTemp', '', '', '');
    $(".invite_list .title h2").bind("click",function(){
        $(this).addClass("cur").siblings().removeClass("cur");
        var listShow = $(".invite_list .title h2").eq(0).hasClass("cur");
        var listhide = $(".invite_list .title h2").eq(1).hasClass("cur");
        if(listShow){
            $(".invite_name").css({"display":"block"});
            $(".invite_gift").css({"display":"none"});
            pg.paging(1, 6, "/user/inviteList", 'friendsList', 'friendsListTemp', '', '', '');
        }else if(listhide){
            $(".invite_gift").css({"display":"block"});
            $(".invite_name").css({"display":"none"});
            pg.paging(1, 6, "/user/inviteIncomeList", 'friendsGift', 'friendsListGift', '', '', '');
        }
    })
    //点击复制
     $('#copy_input').zclip({
            path:'../../js/assets/jquery-zclip/ZeroClipboard.swf',
            copy: function(){
                return $('#mytext').val();
            },
            afterCopy: function(){
                layer.tips("复制成功",'#copy_input');

            }
        });
   // /*生成二维码*/
   //var  qu_code = 'https://www.baidu.com'+'?'+$('#mytext').val();
   // $(".QR-code").qrcode({
   //     render: "table", //table方式
   //     width:150, //宽度
   //     height:150, //高度
   //     text: qu_code,
   // });

    //获取二维码地址
    $.ajax({
        type: "POST",
        url: "/user/getUserQrCode",
        dataType: "json",
        success: function (data) {
            $("#qrCode").attr("src",data.qrCode);
        }
    });

});